package com.xiaodu.validator.controller;

import com.xiaodu.validator.entity.OrderEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.groups.Default;

/**
 * @author: dutianjie
 * @date: 2021/3/31
 * @version: v1.0.0
 * @description: 描述
 **/
@RestController
@RequestMapping("validator")
@Api(tags = "订单操作")
@Validated
public class OrderController {

    public static final Logger log = LoggerFactory.getLogger(OrderController.class);

    @ApiOperation(value = "添加订单", httpMethod = "POST", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping("order")
    public String addOrder(@Validated({Default.class, OrderEntity.OrderGroup.class}) @RequestBody OrderEntity orderEntity) throws Exception {
        return orderEntity.getOrderId();
    }

}
